package com.zx.sdk.util;

import android.os.Handler;
import android.os.Looper;

public class RunnableHelper {
    public static void tryRun(Runnable runnable) {
        try {
            runnable.run();
        } catch (Throwable e) {
            LogHelper.e("tryRun", e);
        }
    }

    public static void postDelay(long delayMillis, Runnable r) {
        Handler handler = new Handler(Looper.getMainLooper());
        handler.postDelayed(r, delayMillis);
    }

    public static void runOnUIThread(Runnable r) {
        Handler handler = new Handler(Looper.getMainLooper());
        handler.post(r);
    }
}
